var app = angular.module("app", []);
app.controller("my_Controller", function($scope, $http) {
	$scope.initView = function() {
		plus.nativeUI.showWaiting('加载中...');
		$http({
			method: 'post',
			url: apiRoot,
			data: {
				action: 'User.getUserInfoByTelOrOpenID',
				uid:cur_uid
			}
		}).then(function successCallback(response) {
			var info = response.data.data;
			if(is_type == 'fans'){
				$scope.fans_list = info.follow.fans;				
				console.log(JSON.stringify($scope.fans_list));
			} else if(is_type == 'follow'){
				$scope.fans_list = info.follow.myfollow;	
				console.log(JSON.stringify($scope.fans_list));
			}
			plus.nativeUI.closeWaiting();
		}, function errorfunction(e) {
			console.log(e);
			plus.nativeUI.closeWaiting();
		})
	}
})

var ws,user_name , cur_uid,is_type;
document.addEventListener("plusready", function() {
	ws = plus.webview.currentWebview();
	appElement = document.querySelector('[ng-controller=my_Controller]');
	$scope = angular.element(appElement).scope();
	cur_uid = ws.uid;
	user_name = ws.Uname;
	isFans = ws.is_fans;
	is_type = ws.is_type;
	$('.mui-title').html(""+user_name+"的"+isFans+"");
	$scope.initView();
	$scope.$apply();
})